<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./bootstrap/bootstrap.min.css">
  <link rel="stylesheet" href="./bootstrap/bootstrap-icons.css">
  <style>
    #box {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      top: 20px;
      padding: 10px;
      background-color: hotpink;
      text-align: center;
      color: #fff
    }
  </style>
</head>
<body>
  <div id="box" class="toast">我是轻提示</div>
  <script src="./bootstrap/bootstrap.min.js"></script>
  <script>
    const toastBox = document.querySelector('#box')
    const toast = new bootstrap.Toast(toastBox, {
      animation: true, // 开启过渡动画
      autohide: true, // 开启自动隐藏
      delay: 3000  // 自动隐藏的延迟时间设置
    })
    toast.show()
  </script>
</body>
</html>